import  {getToken} from '@/utils/index'
// 登录功能，只需要存储 token 即可，所以，状态默认值为：''
const initState = {
  // token: localStorage.getItem('geek-token') || '',
  token :getToken() || ''
};
const user = (state = initState, action) => {
  switch (action.type) {
    case 'login/setToken':
      return {
        ...state,
        token: action.payload,
      };



      case 'user/setName': 
       return {
        ...state,
        name:action.payload
       }


      case 'user/getUserInfo': 

            return  {
              ...state,
              name: action.payload
            }
    default:
      return state;
  }
};

export default user;
